package com.example.pcl.controller.admin;

import com.example.pcl.constant.MessageConstants;
import com.example.pcl.result.Result;
import com.example.pcl.service.HomeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController("adminHomeController")
@RequestMapping("/admin/home")
@Slf4j
@RequiredArgsConstructor
@Tag(name = "管理端首页统计接口")
public class HomeController {

    private final HomeService homeService;

    /**
     * 获取首页统计数据
     *
     * @return 统计数据
     */
    @GetMapping("/statistics")
    @Operation(summary = "获取首页统计数据")
    public Result<?> getStatistics() {
        log.info("管理员查询首页统计数据");
        return Result.success(homeService.getStatistics(), MessageConstants.SELECT_OK);
    }
}